Skip to content

fix(loop): CB_AUTO_RESET and CB_COOLDOWN_MINUTES in .ralphrc are ignored - #392

Closed
meodiemvuong1609 wants to merge 1 commit into
frankbria:mainfrom
meodiemvuong1609:claude/cai-dat-bec815
Closed

meodiemvuong1609 wants to merge 1 commit into
frankbria:mainfrom
meodiemvuong1609:claude/cai-dat-bec815

Conversation

@meodiemvuong1609

Copy link
Copy Markdown

Summary (EN)

CB_AUTO_RESET=true and CB_COOLDOWN_MINUTES set in .ralphrc never take effect. Their _env_* snapshots are taken after the lib source block, and lib/circuit_breaker.sh assigns defaults (false, 30) at source time. The snapshot therefore records the lib default as if it were an environment value, and load_ralphrc restores it over the .ralphrc value. Same class of bug as #369; these two keys were missed when the other CB_* thresholds were moved.

Observed in practice: with CB_AUTO_RESET=true in .ralphrc, an OPEN breaker was never auto-reset on startup. Every restart halted immediately with stagnation_detected until the 30-minute cooldown elapsed.

Thay đổi (VI)

  • ralph_loop.sh: chuyển _env_CB_COOLDOWN_MINUTES và _env_CB_AUTO_RESET vào khối snapshot trước khi source lib (khối [P2.2] Environment does not override .ralphrc for CB_* thresholds, MAX_CONSECUTIVE_*, CLAUDE_MIN_VERSION #369).
  • tests/unit/test_ralphrc_security.bats: thêm hai khoá vào bảng ENV_PRECEDENCE_KEYS. Các test này chạy ralph_loop.sh thật nên bắt được snapshot đặt sai chỗ. Trước khi sửa, test "with no environment value, .ralphrc overrides the default" đỏ với .ralphrc ignored for: CB_COOLDOWN_MINUTES CB_AUTO_RESET.

Kiểm tra

  • bats tests/unit/: 1079 test, 1 đỏ có sẵn trên macOS, không liên quan. issue #346 repro: RALPH_SHELL_INIT_FILE… gọi timeout với PATH=/usr/bin:/bin, mà macOS không có lệnh đó ở đó. Test này cũng đỏ trên main.
  • bats tests/integration/: 289/289 xanh.
  • Thử thật: sau khi sửa, ralph khởi động với breaker OPEN và CB_AUTO_RESET=true trong .ralphrc đã reset về CLOSED rồi chạy tiếp.

🤖 Generated with Claude Code

Snapshot _env_ của hai khoá này nằm sau khối source lib, mà lib/circuit_breaker.sh
gán mặc định (false, 30) lúc source. Snapshot vì thế ghi nhận mặc định như giá trị
env và đè lên .ralphrc: CB_AUTO_RESET=true không bao giờ có tác dụng, circuit
breaker OPEN phải chờ cooldown thay vì tự reset khi khởi động. Chuyển hai dòng vào
khối snapshot trước source (frankbria#369) và thêm chúng vào bảng test dùng ralph_loop.sh thật.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant